﻿<%@ Page Title="WDPA: Register" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true"
    CodeFile="Register.aspx.cs" Inherits="Register" %>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="Server">
    <div class="span-3">
        &nbsp;</div>
    <div class="span-18">
        <table width="100%" cellspacing="0" border="0" align="center" style="text-align: center;">
            <tr>
                <td width="50px">
                    &nbsp
                </td>
                <td>
                    <div id="divRegister" runat="server">
                        <table width="100%" cellpadding="5" cellspacing="0" border="0" style="text-align: left;">
                            <tr>
                                <td colspan="2">
                                    <p>
                                        These details are required so you can register and download data from the WDPA.
                                        Required fields are marked with a *.</p>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    Title:
                                </td>
                                <td>
                                    <asp:DropDownList ID="UserTitle" runat="server">
                                        <asp:ListItem>Mr</asp:ListItem>
                                        <asp:ListItem>Mrs</asp:ListItem>
                                        <asp:ListItem>Miss</asp:ListItem>
                                        <asp:ListItem>Ms</asp:ListItem>
                                        <asp:ListItem>Dr</asp:ListItem>
                                    </asp:DropDownList>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    First Name:
                                </td>
                                <td>
                                    <asp:TextBox ID="FirstName" runat="server" Width="325px" />*
                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="FirstName"
                                        ErrorMessage="Required"></asp:RequiredFieldValidator>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    Family Name:
                                </td>
                                <td>
                                    <asp:TextBox ID="LastName" runat="server" Width="325px" />*
                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="LastName"
                                        ErrorMessage="Required"></asp:RequiredFieldValidator>
                                </td>
                            </tr>
                            <tr>
                                <td colspan="2">
                                    &nbsp;
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    What is your profession?
                                </td>
                                <td>
                                    <asp:DropDownList ID="Profession" runat="server" Width="325px">
                                        <asp:ListItem>Please select</asp:ListItem>
                                        <asp:ListItem>Academic</asp:ListItem>
                                        <asp:ListItem>Conservationist for National Government</asp:ListItem>
                                        <asp:ListItem>Conservationist for International NGO</asp:ListItem>
                                        <asp:ListItem>Student</asp:ListItem>
                                        <asp:ListItem>Work in development sector</asp:ListItem>
                                        <asp:ListItem>Work in private sector</asp:ListItem>
                                        <asp:ListItem>Other</asp:ListItem>
                                    </asp:DropDownList>
                                </td>
                            </tr>
                            <tr>
                                <td colspan="2">
                                    &nbsp;
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    Organisation Name/University or company:
                                </td>
                                <td>
                                    <asp:TextBox ID="OrgName" runat="server" onfocus="clearText()" onblur="resetText()"
                                        Text="Disregard if not part of an organisation" Width="325px" />
                                </td>
                            </tr>
                            <tr>
                                <td colspan="2">
                                    &nbsp;
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    Address Line 1:
                                </td>
                                <td>
                                    <asp:TextBox ID="Addrline1" runat="server" Width="325px" />*
                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="Addrline1"
                                        ErrorMessage="Required"></asp:RequiredFieldValidator>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    Address Line 2:
                                </td>
                                <td>
                                    <asp:TextBox ID="Addrline2" runat="server" Width="325px" />
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    Town/City:
                                </td>
                                <td>
                                    <asp:TextBox ID="AddrTownCity" runat="server" Width="325px" />*
                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ControlToValidate="AddrTownCity"
                                        ErrorMessage="Required"></asp:RequiredFieldValidator>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    Postcode/Zip:
                                </td>
                                <td>
                                    <asp:TextBox ID="AddrPCode" runat="server" Width="325px" />
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    Country:
                                </td>
                                <td>
                                    <asp:DropDownList ID="AddrCountry" runat="server" Width="330px" AppendDataBoundItems="true"
                                        DataTextField="ShortName" DataValueField="ShortName" AutoPostBack="True">
                                        <asp:ListItem>Please Select...</asp:ListItem>
                                    </asp:DropDownList>
                                    *
                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" ControlToValidate="AddrCountry"
                                        ErrorMessage="Required"></asp:RequiredFieldValidator>
                                </td>
                            </tr>
                            <tr>
                                <td colspan="2">
                                    &nbsp;
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    Mobile Phone:
                                </td>
                                <td>
                                    <asp:TextBox ID="MobPhone" runat="server" Width="325px" />
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    Office Phone:
                                </td>
                                <td>
                                    <asp:TextBox ID="Phone" runat="server" Width="325px" />*
                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator6" runat="server" ControlToValidate="Phone"
                                        ErrorMessage="Required"></asp:RequiredFieldValidator><br />
                                    <asp:RegularExpressionValidator ID="RegularExpressionValidatorPhone" runat="server"
                                        ErrorMessage="Invalid Phone Number" ControlToValidate="Phone" ValidationExpression="^(\+[1-9][0-9]*(\([0-9]*\)|-[0-9]*-))?[0]?[1-9][0-9\- ]*$"></asp:RegularExpressionValidator>
                                </td>
                            </tr>
                            <tr>
                                <td colspan="2">
                                    &nbsp;
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    Email Address:
                                </td>
                                <td>
                                    <asp:TextBox ID="EmailAddress1" runat="server" Width="325px" />*<asp:RequiredFieldValidator
                                        ID="RequiredFieldValidator7" runat="server" ControlToValidate="EmailAddress1"
                                        ErrorMessage="Required"></asp:RequiredFieldValidator><br />
                                    <asp:RegularExpressionValidator ID="emailregex" ValidationExpression="^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$"
                                        ControlToValidate="EmailAddress1" runat="server" ErrorMessage="Valid E-mail required"></asp:RegularExpressionValidator>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    Confirm Email Address:
                                </td>
                                <td>
                                    <asp:TextBox ID="EmailAddress2" runat="server" Width="325px" />*
                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator8" runat="server" ControlToValidate="EmailAddress2"
                                        ErrorMessage="Required"></asp:RequiredFieldValidator><br />
                                    <asp:CompareValidator ID="EmailCompare" runat="server" ControlToCompare="EmailAddress1"
                                        ControlToValidate="EmailAddress2" Display="Dynamic" ErrorMessage="The Email Address and Confirm Email Address must match."></asp:CompareValidator>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    Password:
                                </td>
                                <td>
                                    <asp:TextBox ID="Password1" TextMode="Password" runat="server" Width="325px" />*
                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator9" runat="server" ControlToValidate="Password1"
                                        ErrorMessage="Required"></asp:RequiredFieldValidator>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    Confirm Password:
                                </td>
                                <td>
                                    <asp:TextBox ID="Password2" TextMode="Password" runat="server" Width="325px" />*
                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator10" runat="server" ControlToValidate="Password2"
                                        ErrorMessage="Required"></asp:RequiredFieldValidator><br />
                                    <asp:CompareValidator ID="CompareValidator1" runat="server" ControlToCompare="Password1"
                                        ControlToValidate="Password2" Display="Dynamic" ErrorMessage="The Password and Confirm Password must match."></asp:CompareValidator>
                                </td>
                            </tr>
                        </table>
                        <table width="100%" cellpadding="5" cellspacing="0" border="0" style="text-align: left;">
                            <tr>
                                <td>
                                    <asp:Label runat="server" ID="ErrorMessage" ForeColor="Red" />
                                </td>
                                <td align="right" style="width:125px;">
                                    <asp:Button ID="btnRegister" runat="server" Text="Register" OnClick="btnRegister_Click" />
                                </td>
                            </tr>
                        </table>
                    </div>
                    <div id="divRegistrationSuccess" runat="server" visible="false">
                        <fieldset runat="server" id="SignIn" style="padding: 2em; margin: 2em;">
                            <legend style="color: #192F6B; font-weight: bold;">Welcome to the WDPA</legend>
                            <p style="font-size: small; text-align: left;">
                                Your account has been successfully created.<br />
                                However it is currently inactive pending confirmation of your email address .<br />
                                An E-mail has been sent to the address you provided during registration. Please
                                follow the directions in the e-mail to activate your account. If you do not receive
                                the e-mail in your inbox please check your spam filter and allow [protectedareas@unep-wcmc.org.].</p>
                            <p style="text-align: right;">
                                <asp:Button ID="btnFinish" runat="server" Text="Finish" OnClick="btnFinish_Click" />
                            </p>
                        </fieldset>
                    </div>
                </td>
                <td width="50px">
                    &nbsp
                </td>
            </tr>
        </table>
    </div>
    <div class="span-3 last">
        &nbsp;</div>

    <script type="text/javascript">
        function clearText() {
            document.getElementById("<%=OrgName.ClientID%>").value = "";
        }
        function resetText() {
            if (document.getElementById("<%=OrgName.ClientID%>").value == "")
                document.getElementById("<%=OrgName.ClientID%>").value = "Disregard if not part of an organisation"
        }               
    </script>

</asp:Content>
